package dongze.com.ckdj.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;

import butterknife.BindView;
import butterknife.ButterKnife;
import dongze.com.ckdj.R;

/**
 * Created by Administrator on 2017/7/18.
 */
public class SignUpActivity extends BaseActivity {
    @BindView(R.id.input_phone_number)
    EditText mInputPhoneNumber;
    @BindView(R.id.input_received_verification_code)
    EditText mInputReceivedVerificationCode;
    @BindView(R.id.send_verification_code)
    View mSendVerificationCode;
    @BindView(R.id.input_password)
    EditText mInputPassword;
    @BindView(R.id.confirm_password)
    EditText mConfirmPassword;
    @BindView(R.id.argument_checkbox)
    CheckBox mArgumentCheckbox;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);
        ButterKnife.bind(this);
        mInputPhoneNumber.setOnFocusChangeListener(mInputPhoneNumberFocusChangedListener);
    }

    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.send_verification_code:
                Toast.makeText(this, "send vefification code", Toast.LENGTH_SHORT).show();
                break;
            case R.id.sign_up_btn:
                Toast.makeText(this, "sign up", Toast.LENGTH_SHORT).show();
                break;
            case R.id.the_argument:
                Toast.makeText(this, "argument clicked", Toast.LENGTH_SHORT).show();
                break;
        }
    }

    View.OnFocusChangeListener mInputPhoneNumberFocusChangedListener = new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                ((View) v.getParent()).getBackground().setState(new int[] {android.R.attr.state_focused,android.R.attr.state_enabled});
            } else {
                ((View) v.getParent()).getBackground().setState(new int[]{android.R.attr.state_enabled});
            }
        }
    };
}
